/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package view;
import java.awt.ComponentOrientation;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import javax.swing.*;

/**
 *
 * @author Vorak
 */
public class menu extends JMenuBar implements ActionListener{

    JMenu file;
    JMenuItem open;
    JMenuItem save;
    JMenuItem exit;

    JMenu contact;
    JMenuItem add;
    
    ArrayList a;

    public menu(ArrayList list) {
        super();
        a=list;
        file=new JMenu("File");
        exit=new JMenuItem("Exit");
        open=new JMenuItem("Open");
        save=new JMenuItem("Save");
        open.addActionListener(this);
        save.addActionListener(this);
        exit.addActionListener(this);
        file.add(open);
        file.add(save);
        file.add(exit);

        contact=new JMenu("Contacts");
        add=new JMenuItem("Add a contact");
        add.addActionListener(this);
        contact.add(add);

        this.add(file);
        this.add(contact);
        this.setVisible(true);
    }

    public void actionPerformed(ActionEvent e) {
        if(e.getSource()==exit) System.exit(0);
        //if(e.getSource()==add) new formAdd(a);
        //if(e.getSource()==load)
        //if(e.getSource()==save)
    }

}
